#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

int main(int argc, char const *argv[])
{
        if(argc != 2){
                printf("./a.out file name\n");
                return -1;
        }

        int fd = open(argv[1], O_RDONLY);
        
        char buf[1024] = {0};

        // TODO 循环读取,读到0结束
        int ret =  read(fd, buf, sizeof(buf));

        write(STDOUT_FILENO,  buf, ret);

        close(fd);
        return 0;
}
